package com.sansecy.monitor;

import android.graphics.drawable.GradientDrawable;

/**
 * @Description TODO
 * @Date 2019-08-04 02:56
 * @Created by caoyu
 */
public class DrawableUtils {

    public static final int RECTANGLE = 0;

    public static final int OVAL = 1;

    public static final int LINE = 2;

    public static final int RING = 3;

    public static GradientDrawable createDrawable(int shape, int color, int strokeWidth, int strokeColor, int radius) {
        GradientDrawable drawable = new GradientDrawable();
        drawable.setShape(shape);//设置形状为矩形
        drawable.setColor(color);//设置内部填充颜色
        drawable.setStroke(strokeWidth, strokeColor);//设置边框宽度以及颜色
        drawable.setCornerRadius(radius);//设置圆角大小
        return drawable;
    }


    public static GradientDrawable getShape(int color, float radius) {
        GradientDrawable gradientDrawable = new GradientDrawable();
        gradientDrawable.setColor(color);
        gradientDrawable.setCornerRadius(radius);
        return gradientDrawable;
    }

}
